package mysql

import (
	"database/sql"
	"fmt"
)

// 查询是否包含本ip的表格
func TableIsExist(db *sql.DB, ip string) bool {

	// ip = strings.Replace(ip, ".", "_", -1)
	//设置参数以及执行sql语句
	insetStr := `SHOW TABLES LIKE "%s"`
	insetStr = fmt.Sprintf(insetStr, ip)
	var tableName string
	var execErr = db.QueryRow(insetStr).Scan(&tableName)
	if execErr != nil {
		return false
	}
	return true

}
